#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAN_ERR 0
#define MAN_OK 1

struct node {
	char data;
	struct node *next;
};
typedef struct node Node;
typedef struct node *link;

void create_link(link *head) {
	*head = (link)malloc(sizeof(Node));
	(*head)->next = NULL;
}

int is_malloc_ok(link new_node) {
	if (new_node == NULL) {
		printf("malloc error!\n");
		return MAN_ERR;
	}
	return MAN_OK;
}

void create_node(link head, link *new_node, int n) {
	int i;
	char a;
	link p;
	p = head;

	for (i = 1; i <= n; i++) {
		scanf("%c", &a);
		*new_node = (link)malloc(sizeof(Node));
		while (is_malloc_ok(*new_node) == 0) {
			*new_node = (link)malloc(sizeof(Node));
		}
		(*new_node)->data = a;

		while (p->next != NULL) {
			p = p->next;
		}
		p->next = *new_node;
		(*new_node)->next = NULL;
	}
}

int judge_link(link head, int n,int i,int j) {
	link p;
	p = head->next;
	char s[10];
	for (int temp1=0; temp1<i-1; temp1++) {
		p = p->next;
		if(p==NULL){
			return 0;
		}
	}
	for (int temp1=i-1; temp1<j; temp1++) {
		s[i] = p->data;
		p = p->next;
	}
	if (n % 2 == 1) {
		p = p->next;
	}
	j = i - 1;
	for (i = j; i >= 1; i--) {
		if (p->data == s[i]) {
			p = p->next;
		} else {
			break;
		}
	}
	if ( i != 0) {
		return 0;
	} else {
		return 1;
	}
}

void display_link(link head) {
	link p = NULL;

	if (head == NULL) {
		//printf("link is empty!\n");
		return;
	}
	if (head->next == NULL) {
		return;
	} else {
		p = head->next;
		while (p != NULL) {
			//printf("data = %c\n", p->data);
			p = p->next;
		}
	}
}

void release_link(link *head) {
	link p;
	p = *head;

	if (p == NULL) {
		//printf("link is empty!\n");
		return;
	} else {
		p = (*head)->next;
		while (p != NULL) {
			(*head)->next = p->next;
			free(p);
			p = p->next;
		}
		free(*head);
		*head = NULL;
	}
}

int main() {
	link head = NULL;
	link new_node = NULL;
	int n, a;
	//getchar();
	create_link(&head);
	create_node(head, &new_node, n);
	display_link(head);
	a = judge_link(head, n);
	if (a == 0) {
		printf("No\n");
	}
	if (a == 1) {
		printf("Yes\n");
	}
	release_link(&head);
	display_link(head);
	return 0;
}

